package cn.imnaer.service.rpc.location;

import java.util.ArrayList;
import java.util.List;

import cn.imnaer.service.persistence.model.City;
import cn.imnaer.service.persistence.model.consts.SCENIC;
import cn.imnaer.service.rest.view.model.Place;
import cn.imnaer.service.rpc.location.CityComponentRpcApi;

public class CityComponentRpcApiImpl implements CityComponentRpcApi {



	public CityComponentRpcApiImpl() {

	}



	@Override
	public String getCitName(String cityCode) {

		return new CityRepository().getCityNameByCityCode(cityCode);
	}

	@Override
	public List<Place> search(String keyword) {
	             	List<City> record = new CityRepository().search(keyword);
					List<Place> places = new ArrayList<>(record.size());
					for (City city : record) {
						Place place = new Place();
						place.setAttribute(city);
						places.add(place);
					}
					return places;
		
	}

}
